$(function(){
	$.autoFillForm();
	$(".submit_btn").click(function(){
		if($.trim($("#yourname1").val()) !== "" && $.trim($("#yourname2").val()) !== ""){
			$.saveForm();
			$("#index_form").submit();
		}else{
			alert("请输入姓名");
		}
	});
	$(".menu_a").live('click',function(){
		var tpage = $(this).attr("topage");
		var flag = $(this).attr("attr");
		$('#mybook').booklet("gotopage", new Number(tpage)-1);
	});
	$("#mybook").booklet({
		width:710,//730
		height:512,
		pagePadding:0,
		start: function(event, data) {
			if(data.index > 1){
				$(data.pages[0]).css("background-color","#F7D0A9");
				$(data.pages[0]).css("background-image","url('../../3s/images/"+data.index/2+".jpg')");
				if($.trim(data.pages[1].innerHTML) === ""){
					$.post("process",{ri:$("#data").attr("ri"),shi:$("#data").attr("shi"),nian:$("#data").attr("nian"),yue:$("#data").attr("yue"),bizflag:$(data.pages[1]).attr("attr")},function(dat){
						$(data.pages[1]).append("<div class='result_title'>"+$("a[topage="+(data.index+2)+"]").html()+"</div><div>"+dat+"</div><div class='backMenu'><a href='javascript:menu();'>[目录]</a><a href='javascript:replay();'>[重新测算]</a></div>");//"<img src='sanshishu/images/"+dat+"'/>";
					});
				}
			}
		}
	});
});
function menu(){
	$("#mybook").booklet("gotopage","1");
}
function replay(){
	window.location.href = "../../3s/3sbook.html";
}